﻿<%@ WebService Language="C#" Class="MapService" %>

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using Reimers.Map;
using System.Web.Script.Services;
using Reimers.Map.Accessories;

/// <summary>
/// Summary description for MapService
/// </summary>
[WebService(Namespace = "http://www.reimers.dk/")]
[ScriptService]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class MapService : System.Web.Services.WebService
{

	public MapService()
	{

		//Uncomment the following line if using designed components 
		//InitializeComponent(); 
	}

	[WebMethod, ScriptMethod]
	public KeyValuePair<GoogleMarker, string> HandleClick(GoogleLatLng point, string mapState)
	{
		GoogleMarker marker = new GoogleMarker(Guid.NewGuid().ToString("N"), point);
		marker.ClientSideHandlers.OnClick = GoogleMarker.OpenInfoWindowHTML("Some XXXX text to display for marker " + marker.ID);
		GoogleOverlayCollection goc = new GoogleOverlayCollection(mapState, DataFormat.ViewState);
		goc.Add(marker);

		return new KeyValuePair<GoogleMarker, string>(marker, goc.SaveViewState("sMap"));
	}

}

